package com.muyu.system.service.impl;

import com.muyu.common.core.utils.DateUtils;
import com.muyu.system.domain.DmShoppingSku;
import com.muyu.system.mapper.DmShoppingSkuMapper;
import com.muyu.system.service.IDmShoppingSkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品skuService业务层处理
 *
 * @author ruoyi
 * @date 2025-01-16
 */
@Service
public class DmShoppingSkuServiceImpl implements IDmShoppingSkuService {
    @Autowired
    private DmShoppingSkuMapper dmShoppingSkuMapper;

    /**
     * 查询商品sku
     *
     * @param id 商品sku主键
     * @return 商品sku
     */
    @Override
    public DmShoppingSku selectDmShoppingSkuById(Long id) {
        return dmShoppingSkuMapper.selectDmShoppingSkuById(id);
    }

    /**
     * 查询商品sku列表
     *
     * @param dmShoppingSku 商品sku
     * @return 商品sku
     */
    @Override
    public List<DmShoppingSku> selectDmShoppingSkuList(DmShoppingSku dmShoppingSku) {
        return dmShoppingSkuMapper.selectDmShoppingSkuList(dmShoppingSku);
    }

    /**
     * 新增商品sku
     *
     * @param dmShoppingSku 商品sku
     * @return 结果
     */
    @Override
    public int insertDmShoppingSku(DmShoppingSku dmShoppingSku) {
        dmShoppingSku.setCreateTime(DateUtils.getNowDate());
        return dmShoppingSkuMapper.insertDmShoppingSku(dmShoppingSku);
    }

    /**
     * 修改商品sku
     *
     * @param dmShoppingSku 商品sku
     * @return 结果
     */
    @Override
    public int updateDmShoppingSku(DmShoppingSku dmShoppingSku) {
        dmShoppingSku.setUpdateTime(DateUtils.getNowDate());
        return dmShoppingSkuMapper.updateDmShoppingSku(dmShoppingSku);
    }

    /**
     * 批量删除商品sku
     *
     * @param ids 需要删除的商品sku主键
     * @return 结果
     */
    @Override
    public int deleteDmShoppingSkuByIds(Long[] ids) {
        return dmShoppingSkuMapper.deleteDmShoppingSkuByIds(ids);
    }

    /**
     * 删除商品sku信息
     *
     * @param id 商品sku主键
     * @return 结果
     */
    @Override
    public int deleteDmShoppingSkuById(Long id) {
        return dmShoppingSkuMapper.deleteDmShoppingSkuById(id);
    }
}
